package cn.edu.ctbu.datajpacrud.service;
import cn.edu.ctbu.datajpacrud.domain.Teacher;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public interface TeacherService {


    /**
     * 只分页的查询
     *
     * @return
     */
//    Page<Teacher> findAll(PageRequest pageable);
    Page<Teacher> findAll(Pageable pageable);

    public  Page<Teacher> findAll(Example<Teacher> teacher,Pageable pageable);

    List<Teacher> findAll();

    /**
     * 按id进行查询
     *
     * @param id 主键，整数
     * @return
     */
    Teacher findById(Integer id);



    /**
     * 按名字进行查询，like
     *
     * @param name
     * @return
     */
    List<Teacher> findByName(String name);

    /**
     * 按名字和性别进行查询
     * @param name
     * @param sex
     * @return
     */
    List<Teacher> findByNameAndSex(String name, String sex);


    /**
     * 查询工号最大的用户
     * @return
     */
    Teacher getTeacherMaxNo();
    /**
     * 添加新的用户记录
     *
     * @param teacher
     * @return
     */
    Teacher insert(Teacher teacher);

    /**
     * 更新用户信息
     * @param teacher
     * @return
     */
    Teacher update(Teacher teacher);

    /**
     * 删除用户
     * @param teacher
     */
    void delete(Teacher teacher);

    Teacher getById(Integer id);





}
